﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>

<%	dim rs,sql,i,id,PageCount,Page,PageOut,PageIn,PageSize,content,classid,RepCount

	PageSize=500

	id=Request("id")
	if id="" then id=0
	if not isnumeric(id) then id=0
	id=clng(id)

    	Page = Request("page")      '当前页数
    	If Page = "" Then Page = 1
   	If Not IsNumeric(Page) Then Page = 1
    	Page = CLng(Page)
    	If Page < 1 Then Page = 1


	Set Rs = Server.CreateObject("Adodb.Recordset")

	Sql = "select [name],[time],[content] from qingtian_gongguao where id="&id
	Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof)  then




	content=rs("content")
	''''''''''''''''''智能分页''''''''''''''''''''''
        Dim  n
        I = 1
        Do
            n = n + 1
            If n = page Then
                PageIn = I
            End If
            If InStr(I, content, "[page]") - I < PageSize + PageSize / 4 * 3 And InStr(I, content, "[page]") <> 0 Then
                I = InStr(I, content, "[page]") + 6
            Else
                I = I + PageSize
            End If
            If n = page Then
                PageOut = I
            End If



        Loop While I < Len(content)
        PageCount = n
	if page>PageCount then page=PageCount

	if Pagein="" then Pagein=(PageCount-1)*PageSize+1
	if Pageout="" then Pageout=Len(content)-(PageCount-1)*PageSize+Pagein
	
	if len(content)>0 then content=replace(mid(content,Pagein,Pageout-Pagein),"[page]","")

select case v
case "0"
we0="<br/>"
hr="-------------<br/>"
book="跳到第<input name='Page' format='*N' size='2' maxlength='5'/><anchor>页<go href='gongguaove.asp?id="&id&"&amp;sid="&sidd&"' method='post'><postfield name=""Page"" value=""$(Page:n)"" /></go></anchor><br/>"
%>
<card title="<%=qingtian.utf8(rs("name"))%>"><p align="<%=qingtian.px%>">
<%
case "1"
hr=""
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
book=""&dao&"<form action=""gongguaove.asp?id="&id&"&amp;sid="&sidd&""" method=""post"">跳到第<input type=""text"" name=""Page"" value="""" format=""*N"" size=""2"" maxlength=""5""/><input type=""submit"" value=""页"" /></form>"&we0&""
%>
<title><%=qingtian.utf8(rs("name"))%></title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%

End Select

%><%


		if sid="Null" then
		%><%=we%><%=zi%>欢迎你<%=zi0%><a href="login.asp?sid=<%=sidd%>&amp;url=gongguaove.asp?id=<%=id%>">注册/登陆</a><%=we0%><%
		else
		qingtian.info
		end if
		%>
<%=qingtian.qingsav("7")%>
		<%=dao%>标题:<%=qingtian.utf8(rs("name"))%><%=we0%>
		<%=sou%>添加时间:<%=qingtian.FormatTime(rs("Time"),0)%><%=we0%>
		<%=we%><%=qingtian.ubb(content)%><%=we0%>
<%=hr%>
<%
                if PageCount>1 then
                    Response.Write dao
                end if
   		'分页
    		If Page < PageCount Then
    		    Response.Write("<a href='gongguaove.asp?id="&id&"&amp;page=" & Page + 1 & "&amp;sid="&sidd&"'>下一页</a>")
    		End If
       
    		If Page > 1 And Page < PageCount Then
    		    Response.Write("|")
    		End If
        
    		If Page > 1 Then
    		    Response.Write("<a href='gongguaove.asp?id="&id&"&amp;page=" & Page - 1 & "&amp;sid="&sidd&"'>上一页</a>" & we0 & "")
    		Elseif PageCount >1 then
    		    Response.Write("" & we0 & "")
    		End If
            
    		Randomize()
    
    		If PageCount > 2 Then
    		    %>
		<%=book%>
		<%
    		Response.Write("" & sou & "(第" & Page & "/总" & PageCount & "页/"&len(content)&"字)" & we0 & "")
   		End If
                                                               

	else
		
select case v
case "0"
we0="<br/>"
%>
<card title="出错啦"><p align="<%=qingtian.px%>">
<%
case "1"
hr="<hr>"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>出错啦</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%

End Select

%>出错啦<%
		classid=0
 	end if
		Rs.close


	set rs=nothing
%><%=qingtian.qingsav("6")%><%
   		    Response.Write(""&sou&"<a href='gongaolist.asp?sid="&sidd&"'>公告列表</a>"&we0&"")
%>
<%
end Function
%>
